<template>
  <div>
    <p>2. 查询某本书籍信息</p>
    <input type="text" placeholder="请输入要查询的书名" v-model="bName" />
    <button @click="findFn">查询</button>
  </div>
</template>

<script>
import axios from "axios";
export default {
  data() {
    return {
      bName: "",
    };
  },
  methods: {
    findFn() {
      axios({
        method: "get",
        url: "http://123.57.109.30:3006/api/getbooks",
        params: {
          // 都会axios最终拼接到url?后面
          bookname: this.bName,
        },
      })
        .then((res) => {
          console.log(res);
        })
        .catch((err) => {
          console.log(err);
        });
    },
  },
};
</script>

<style>
</style>